<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
>
<head>
    <!-- 设置页面的 基本路径，页面所有资源引入和页面的跳转全部基于 base路径 -->
    <base th:href="${#request.getContextPath()}+'/'">
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="Bookmark" href="/favicon.ico">
    <link rel="Shortcut Icon" href="/favicon.ico"/>

    <script type="text/javascript" th:src="@{/lib/html5shiv.js}"></script>
    <script type="text/javascript" th:src="@{/lib/respond.min.js}"></script>
    <link rel="stylesheet" type="text/css" th:href="@{/h-ui/css/H-ui.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/h-ui.admin/css/H-ui.admin.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/lib/Hui-iconfont/1.0.8/iconfont.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/h-ui.admin/skin/default/skin.css}" id="skin"/>
    <link rel="stylesheet" type="text/css" th:href="@{/h-ui.admin/css/style.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/lib/bootstrap/css/bootstrap.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/lib/bootstrap-table/bootstrap-table.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}"/>


</head>
<body>

<div class="page-container" style="padding: 0 20px">
     <span id="toolbar" class="l">
            <a href="javascript:;" onclick="case_check_add()"
               class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>添加</a>
            <a href="javascript:;" onclick="case_check_close()"
               class="btn btn-success radius"><i class="Hui-iconfont">&#xe600;</i>添加并关闭</a>
    </span>

    <input type="hidden" id="caseOrderNumber" th:value="${caseOrderNumber}">



    <table id="dataTable" class="table table-border table-bordered table-bg">
    </table>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" th:src="@{/lib/jquery/1.11.3/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{/lib/layer/2.4/layer.js}"></script>
<script type="text/javascript" th:src="@{/h-ui/js/H-ui.min.js}"></script>
<script type="text/javascript" th:src="@{/h-ui.admin/js/H-ui.admin.js}"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" th:src="@{/lib/My97DatePicker/4.8/WdatePicker.js}"></script>
<script type="text/javascript" th:src="@{/lib/datatables/1.10.0/jquery.dataTables.min.js}"></script>
<script type="text/javascript" th:src="@{/lib/bootstrap-table/bootstrap-table.js}"></script>
<script type="text/javascript" th:src="@{/lib/bootstrap-table/bootstrap-table-zh-CN.min.js}"></script>


<script type="text/javascript">
    $(function () {
        $('#dataTable').bootstrapTable({
            url: 'check/list',//ajax请求的url地址
            pagination: true,
            toolbar: "#toolbar",//顶部显示的工具条（添加和批量删除的）
            contentType: 'application/x-www-form-urlencoded',//条件搜索的时候ajax请求给后台数据的数据类型（条件搜索post提交必须设置）
            search: true,//是否显示搜索框
            pageNumber: 1,//默认的页面 第一页
            pageSize: 5,//默认的每页条数
            sidePagination: "server",//是否是服务器分页，每次请求都是对应的10条数据，下一页发送ajax请求
            paginationHAlign: 'right', //底部分页条
            columns: [
                {checkbox:true},
                {field: 'checkId', title: '编号'},
                {field: 'checkName', title: '检查项目名称'},
                {field: 'dictionary.dictionaryName', title: '项目类别'},
                {field: 'checkMoney', title: '项目单价'}],
            queryParams: function (params) {
                //此方法在用户分页或者搜索的时候回自动发送ajax请求调用，并把对应的参数传递给后台
                return {
                    pageNum: params.offset / params.limit + 1, //页码
                    pageSize: params.limit, //页面大小
                    keyword: params.search
                };
            }
        });

    });

</script>



    <script type="text/javascript">

        function case_check_add() {

            var select= $('#dataTable').bootstrapTable('getSelections')
            var checkIds=new Array()
            $.each(select,function (index,row) {
                checkIds[index]=row.checkId
            })
            $.get("newVisit/chooseCheck",{caseOrderNumber:$("#caseOrderNumber").val(),checkIds:checkIds.toString()},function (data) {
                layer.msg(data.msg,{icon:data.code,time:1000})
            })
        }
    function case_check_close() {

        var select= $('#dataTable').bootstrapTable('getSelections')
        var checkIds=new Array()
        $.each(select,function (index,row) {
            checkIds[index]=row.checkId
        })

        $.get("newVisit/chooseCheck",{caseOrderNumber:$("#caseOrderNumber").val(),checkIds:checkIds.toString(),close:"close"},function (data) {
            layer.msg(data.msg,{icon:data.code,time:1000},function () {
                if (data.code == 1){
                    parent.showCheck()
                    parent.layer.closeAll()
                }
            })
        })
    }


</script>
</body>
</html>
